An “object” in an object-oriented programming language is an encapsulated module of code and related data that is accessible to clients through interfaces accessing well-defined and controlled connection points, known as the object's methods and properties. A collection of objects can be created to perform the functions desired in a computer application.
Component Object Model (COM) is a binary interface standard for software componentry used to enable communication and dynamic object creation in any programming language that supports it. The term COM is often used in the software development world as an umbrella term that encompasses the OLE, OLE Automation, ActiveX®, COM+ and DCOM technologies. COM provides a language-neutral way of implementing objects so an object can be used in an environment different from the one in which it was created.
One mechanism that enables object reuse in COM is containment delegation. Containment delegation is a mechanism in which one object (the “outer” object) uses functionality of another object (the “inner” object) to provide interface implementations to the outer object's clients. The outer object “contains” the inner object. The outer object exposes interfaces to a client, but its implementation of some of those interface properties and methods explicitly delegates to the inner object's methods. Containment for an outer object can be implemented by the outer object creating the inner objects it uses; using its pointer to the inner object, a call to a method in the outer object generates a call to a method in the inner object.
COM aggregation is an extension to containment delegation of COM objects in which the outer object exposes interfaces from the inner object directly. That is, when a client of the outer object requests an interface, if the outer object does not have an implementation of that interface, it forwards the request to the inner object. If the inner object returns an interface, the outer object's client then makes method and property calls directly to that inner object. Note that the inner object can itself be an outer object to a third object, and might similarly forward the interface requests. The outer-most object is called the “controlling” object. If a client is interacting with an inner object and requests a new interface, the inner object forwards the request to the controlling object, so that the outer objects have an opportunity to answer a request before inner objects. This aggregation algorithm can be useful when the outer object delegates all calls to one of its interfaces to the same interface in the inner object. COM aggregation can avoid extra implementation overhead in the outer object in this case.